<template>
  <el-row :gutter="20" class="panel-group">
    <el-col :xs="16" :sm="16" :lg="8" class="card-panel-col">
      <!-- <div class="card-panel" @click="handleSetLineChartData('messages')"> -->
      <div id="indexbox1" class="card-panel">
        <!-- <div class="card-panel-icon-wrapper icon-message">
          <svg-icon icon-class="form" class-name="card-panel-icon" />
        </div> -->
        <div class="card-panel-description">
          <count-to :start-val="0" :end-val="countNum1" :duration="3000" class="card-panel-num" />
          <div class="card-panel-text">
            立案数
          </div>
        </div>
      </div>
    </el-col>
    <el-col :xs="16" :sm="16" :lg="8" class="card-panel-col">
      <!-- <div class="card-panel" @click="handleSetLineChartData('newVisitis')"> -->
      <div id="indexbox2" class="card-panel">
        <!-- <div class="card-panel-icon-wrapper icon-people">
          <svg-icon icon-class="peoples" class-name="card-panel-icon" />
        </div> -->
        <div class="card-panel-description">
          <count-to :start-val="0" :end-val="countNum2" :duration="2600" class="card-panel-num" />
          <div class="card-panel-text">
            集资人数
          </div>
        </div>
      </div>
    </el-col>
    <el-col :xs="16" :sm="16" :lg="8" class="card-panel-col">
      <!-- <div class="card-panel" @click="handleSetLineChartData('purchases')"> -->
      <div id="indexbox3" class="card-panel">
        <!-- <div class="card-panel-icon-wrapper icon-money">
          <svg-icon icon-class="money" class-name="card-panel-icon" />
        </div> -->
        <div class="card-panel-description">
          <count-to :start-val="0" :end-val="countNum3" :duration="3200" class="card-panel-num" />
          <div class="card-panel-text">
            涉及金额：万元
          </div>
        </div>
      </div>
    </el-col>
  </el-row>
</template>

<script>
import CountTo from 'vue-count-to'

export default {
  components: {
    CountTo
  },
  props: {
    countNum1: {
      type: Number,
      default: 0
    },
    countNum2: {
      type: Number,
      default: 0
    },
    countNum3: {
      type: Number,
      default: 0
    },
    timestamp: {
      type: Number,
      default: 0
    }
  },
  watch: {
    timestamp: {
      handler(val, oldVal) {
        console.log(this.countNum1)
        console.log(this.countNum2)
        console.log(this.countNum3)
      },
      immediate: true
    }
  },
  methods: {
    handleSetLineChartData(type) {
      this.$emit('handleSetLineChartData', type)
    }
  }
}
</script>

<style lang="scss" scoped>
#indexbox1{
  background:url('../../../../assets/indexbox1.png') bottom no-repeat;
}
#indexbox2{
  background:url('../../../../assets/indexbox2.png') bottom no-repeat;
}
#indexbox3{
  background:url('../../../../assets/indexbox3.png') bottom no-repeat;
}
.panel-group {
  margin-top: 0px;

  .card-panel-col {
    margin-bottom: 20px;
  }

  .card-panel {
    height: 140px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;

    &:hover {
      .card-panel-icon-wrapper {
        color: #fff;
      }

      .icon-people {
        background: #40c9c6;
      }

      .icon-message {
        background: #36a3f7;
      }

      .icon-money {
        background: #f4516c;
      }

      .icon-shopping {
        background: #34bfa3
      }
    }

    .icon-people {
      color: #40c9c6;
    }

    .icon-message {
      color: #36a3f7;
    }

    .icon-money {
      color: #f4516c;
    }

    .icon-shopping {
      color: #34bfa3
    }

    .card-panel-icon-wrapper {
      float: left;
      margin: 14px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }

    .card-panel-icon {
      float: left;
      font-size: 48px;
    }

    .card-panel-description {
      float: left;
      font-weight: bold;
      margin: 32px 0 0 120px;

      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-top: 12px;
        color: #fff;
      }

      .card-panel-num {
        font-size: 36px;
        color: #fff;
      }
    }
  }
}

@media (max-width:550px) {
  .card-panel-description {
    display: none;
  }

  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;

    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
</style>
